home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel PPC / lib_std / platform.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  2.8 KB  |  130 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class PLATFORM
  5.  
  6. inherit GENERAL;
  7.    
  8. feature -- Maximum :
  9.  
  10.     Maximum_character_code : INTEGER is
  11.      -- Largest supported code for CHARACTER values.
  12.       once
  13.      c_inline_c("R=CHAR_MAX;");
  14.       ensure
  15.      meaningful: Result >= 127
  16.       end;
  17.  
  18.     Maximum_integer: INTEGER is
  19.       -- Largest supported value of type INTEGER.
  20.       once
  21.      c_inline_c("R=INT_MAX;");
  22.       ensure
  23.      meaningful: Result >= 0
  24.       end;
  25.  
  26.     Maximum_real: REAL is
  27.       -- Largest supported value of type REAL.
  28.       once
  29.      c_inline_c("R=FLT_MAX;");
  30.       ensure
  31.      meaningful: Result >= 0.0
  32.       end;
  33.  
  34.     Maximum_double: DOUBLE is
  35.       -- Largest supported value of type DOUBLE.
  36.       once
  37.      c_inline_c("R=DBL_MAX;");
  38.       ensure
  39.      meaningful: Result >= 0.0
  40.       end;
  41.  
  42. feature -- Minimum :
  43.  
  44.    Minimum_character_code: INTEGER is
  45.       -- Smallest supported code for CHARACTER values.
  46.       once
  47.      c_inline_c("R=CHAR_MIN;");
  48.       ensure
  49.      meaningful: Result <= 0
  50.       end;
  51.  
  52.    Minimum_integer: INTEGER is
  53.       -- Smallest supported value of type INTEGER.
  54.       once
  55.      c_inline_c("R=INT_MIN;");
  56.       ensure
  57.      meaningful: Result <= 0
  58.       end;
  59.  
  60.    Minimum_double: DOUBLE is
  61.       -- Smallest supported value of type DOUBLE.
  62.       once
  63.      Result := - Maximum_double;
  64.       ensure
  65.      meaningful: Result <= 0
  66.       end;
  67.  
  68.    Minimum_real: REAL is
  69.       -- Smallest supported value of type REAL.
  70.       once
  71.      Result := - Maximum_real;
  72.       ensure
  73.      meaningful: Result <= 0
  74.       end;
  75.  
  76. feature -- Bits :
  77.  
  78.    Boolean_bits: INTEGER is
  79.       -- Number of bits in a value of type BOOLEAN.
  80.       once
  81.      Result := Character_bits * (true).object_size;
  82.       ensure
  83.      meaningful: Result >= 1
  84.       end;
  85.  
  86.    Character_bits: INTEGER is
  87.       -- Number of bits in a value of type CHARACTER.
  88.       once
  89.      c_inline_c("R=CHAR_BIT;");
  90.       ensure
  91.      meaningful: Result >= 1;
  92.      large_enough: (2^Result) >= Maximum_character_code;
  93.       end;
  94.  
  95.    Integer_bits: INTEGER is
  96.      -- Number of bits in a value of type INTEGER.
  97.       once
  98.      Result := Character_bits * (1).object_size;
  99.       ensure
  100.      meaningful: Result >= 1;
  101.       end;
  102.    
  103.    Real_bits: INTEGER is
  104.      -- Number of bits in a value of type DOUBLE.
  105.       once
  106.      Result := Character_bits * (1.5).object_size;
  107.       ensure
  108.      meaningful: Result >= 1;
  109.      meaningful: Result >= Real_bits;
  110.       end;
  111.  
  112.    Double_bits: INTEGER is
  113.      -- Number of bits in a value of type DOUBLE.
  114.       once
  115.      Result := Character_bits * (1.5).to_double.object_size;
  116.       ensure
  117.      meaningful: Result >= 1;
  118.      meaningful: Result >= Real_bits;
  119.       end;
  120.  
  121.    Pointer_bits: INTEGER is
  122.      -- Number of bits in a value of type REAL.
  123.       local
  124.      p: POINTER;
  125.       once
  126.      Result := Character_bits * p.object_size;
  127.       end;
  128.  
  129. end -- PLATFORM
  130.